#!/bin/bash

mpstat $1 $2 > $3


sqa@sqa-VirtualBox:~$ chmod +x wk6.sh
sqa@sqa-VirtualBox:~$ ./wk6.sh 1 4 test.dat
sqa@sqa-VirtualBox:~$ more test.dat
Linux 3.2.0-30-generic-pae (sqa-VirtualBox) 	22/10/13 	_i686_	(2 CPU)

12:53:52     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest
   %idle
12:53:53     all    0.50    0.00    0.50    0.00    0.00    0.00    0.00    0.00
   99.00
12:53:54     all    0.50    0.00    0.50    0.00    0.00    0.00    0.00    0.00
   99.00
12:53:55     all    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00
  100.00
12:53:56     all    0.50    0.00    0.50    0.00    0.00    0.00    0.00    0.00
   99.00
Average:     all    0.37    0.00    0.37    0.00    0.00    0.00    0.00    0.00
   99.25

